<template>
  <!--顶部-->
  <div class="sidebar-top">
     <div>学生界面</div>
     <div>退出</div>
  </div>
  <div class="sidebar-cont">
      <el-menu :default-active="ac_index" @select="Select">
          <div v-for="(item,index) in menu" :key="index">
            <router-link :to="{path:item.router}">
              <el-menu-item  :index="item.id">
                {{ item.title }}
              </el-menu-item>
          </router-link>   
      </div>
      </el-menu>
  </div>
  
 <router-view></router-view>
</template>
<script>
import {} from '@element-plus/icons-vue'
import {reactive,ref,onMounted} from 'vue'
export default{
  setup(){
      const Array =[
          {
              id:'1',
              title:'查询全部获奖情况1',
              router:'student_01',
              Subclass:[]//二级菜单
          },
          {
              id:'2',
              title:'插入成果鉴定信息2',
              router:'student_02',
              Subclass:[]//二级菜单
          },
          {
              id:'3',
              title:'插入获奖成果申报情况3',
              router:'student_03',
              Subclass:[]//二级菜单
          },
          {
              id:'4',
              title:'学生修改获奖信息4',
              router:'student_04',
              Subclass:[]//二级菜单
          },
          {
              id:'5',
              title:'删除未审批的获奖情况5',
              router:'student_05',
              Subclass:[]//二级菜单
          },
          {
              id:'6',
              title:'其他界面6',
              router:'student_06',
              Subclass:[
              ]//二级菜单
          },
      ]
      const menu = reactive(Array)
      //菜单激活回调
      const ac_index = ref('1')
      function Select(index,path){
         localStorage.setItem('menuid',JSON.stringify(index))
      }
      onMounted(()=>{
          ac_index.value = JSON.parse(localStorage.getItem('menuid'))
      })
      return {menu,ac_index,Select}
  }
}
</script>
<style>
</style>